package cn.wolfcode.domain;

import lombok.Data;

import java.util.List;

@Data
public class Question {
    private Long id;
    /**
     * 标题
     */
    private String title;
    /**
     * 类型(单选/多选/判断)
     */
    private Integer type;
    /**
     * 判断正确(针对判断题才有此项)
     */
    private Boolean judgeRight;

    private List<QuestionItem> items;

    public String getAnswer() {
        String str="";
        for(QuestionItem item:items){
            if (item.getJudgeRight()){
                str+= item.getTitle().substring(0,item.getTitle().indexOf('.'));
            }
        }
        return str;
    }
}